/****   http.js   ****/
// 导入封装好的axios实例
import request from '@/utils/request'
//封装uni.request()：

const $ = {
  /**
   * methods: 请求
   * @param url 请求地址
   * @param params 请求参数
   */
  get (url, data = {}, options = {}) {
    options.url = url
    options.params = data
    options.method = 'get'
    return request(options)
  },
  post (url, data = {}, options = {}) {
    options.url = url
    options.data = data
    options.method = 'post'
    return request(options)
  },
  put (url, data = {}, options = {}) {
    options.url = url
    options.params = data
    options.method = 'put'
    return request(options)
  },
  delete (url, data = {}, options = {}) {
    options.url = url
    options.params = data
    options.method = 'delete'
    return request(options)
  },
}
//导出
export default $
